<script>
	
	function cancel(){
		window.close();
	}
	function save(){
		$("#frmTahunAjaran").submit();		
	}
	
</script>
<?php
			$mcon= Yii::app()->db;
			$sql1='select name from m_kalender_akademik group by name';
			$mKalenderAkademik=$mcon->createCommand($sql1);		
			$rsDep=$mKalenderAkademik->queryAll();	
			$arrOptions=array();
			$data_array="";
			foreach($rsDep as $rw){
				$data_array.= '"'.$rw['name'].'",';
			}
				 
?>				
 <script>
$(function() {
var availableTags = [<?php echo $data_array;?>];
$( "#name" ).autocomplete({
source: availableTags
});
});
</script>
<?php
	//echo $op;
	//print_r($op);
?>

<div style="border-bottom:2px solid #000;padding-bottom:5px;margin-bottom:20px">
<?php 
	$this->widget('application.components.widgets.ActionBar', 
		array("menuAlign" => "right", 
			'items' => array(
				array(
					'id' => "btnRefresh",
					'title' => "Simpan",
					'icon' => "images/action/Actions-document-save-all-icon.png",
					'callback'=>"save"
				),					
				array(
					'id' => "btnCancel",
					'title' => "Batal",
					'icon' => "images/action/Actions-dialog-cancel-icon.png",
					'callback'=>"cancel"
				),
			)
		)
	);
?>
</div>

<script>
	
	
</script>
 
<form id="frmTahunAjaran" action="index.php?r=akKalender_Akademik/edit" method="POST">	
	<input type="hidden" name="op" value="<?php echo $op ?>" readonly/>
	<input type="hidden" name="id" id="id" value="<?php echo $id ?>" readonly/>
 
    <div>
        <label class="form mandatory" style="width:100px"><?php echo Yii::t("label","Department");?></label>
        <label class="form mandatory" style="width:10px">:</label>
        <label class="form" style="width:100px"><?php echo $department_id ;?></label>
        <input type="hidden" id="department_id" name="department_id" value="<?php echo $department_id;?>" size="10"   />
    </div>

    
	<div>
		<input type="hidden" id="tahun_ajaran_id" name="tahun_ajaran_id" value="<?php echo $tahun_ajaran_id ?>"/>
		<label class="form mandatory" style="width:100px"> <?php echo Yii::t("label","Tahun Ajaran") ?></label> 		
		<?php
			$rsDep = MTahunAjaran::model()->findAll("id='".$tahun_ajaran_id."' order by id");
			$arrOptions=array();
			foreach($rsDep as $rw){
				$selected = $tahun_ajaran_id == $rw->id ? true : false;
				$arrOptions[] = array("label"=>$rw->name,"value"=>$rw->id,"selected"=>$selected);
			}
			$this->widget('application.components.widgets.SelectField', 
				array("name"=>"tahun_ajaran_id",
					"value"=>"",
					"htmlOptions"=>"disabled",
					"label"=>array(
						"value"=>"",
						"htmlOptions"=>""
					),
					"options"=>$arrOptions,
				)
			);
			
		?>		
	</div>
    <div>
        <?php $this->widget('application.components.widgets.TextField', 
            array("name"=>"name","value"=>$name,"htmlOptions"=>"size='20'",
                "label"=>array("value"=>Yii::t("label","Name"),"htmlOptions"=>"class='form mandatory' style='width:100px'")
            ));
        ?>
    </div>    
    <div>
    <?php $this->widget('application.components.widgets.DateTextField', 
        array("name"=>"start_date","value"=>$start_date,"htmlOptions"=>"size='20'",
            "label"=>array("value"=>Yii::t("label","Start Date"),"htmlOptions"=>"class='form mandatory' style='width:100px'")
        ));
    ?>
    </div>
    <div>
    <?php $this->widget('application.components.widgets.DateTextField', 
        array("name"=>"end_date","value"=>$end_date,"htmlOptions"=>"size='20'",
            "label"=>array("value"=>Yii::t("label","End Date"),"htmlOptions"=>"class='form mandatory' style='width:100px'")
        ));
    ?>
    </div>                
 
    <div>
        <label class="form" style="width:100px;vertical-align:top"><?php echo Yii::t("label","Detail Activity");?></label><textarea id="detail_activity" name="detail_activity" style="width:220px"><?php echo $detail_activity; ?></textarea>
    </div>
	 
 
	
</form>

